﻿using Pattern07适配器模式.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Pattern07适配器模式.Models
{
    public class BicycleCombinationAdapter : IVehicle
    {
        private Bicycle _bicycle = null;
        public Bicycle Bicycle 
        {
            get 
            {
                return _bicycle;
            }
            set
            {
                if(value != null)
                {
                    _bicycle = value;
                }
            }
        }

        public BicycleCombinationAdapter(Bicycle bicycle =null)
        {
            if (bicycle != null)
            {
                _bicycle = bicycle;
            }
        }

        public void SetBicycle(Bicycle bicycle)
        {
            if (bicycle != null)
            {
                _bicycle = bicycle;
            }
        }

        public void Run()
        {
            _bicycle?.Cycling();
        }

        public void Whistle()
        {
            _bicycle?.RingBell();
        }
    }
}
